package eu.winterwheels.enterprise.model.general;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@XmlRootElement
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "countryCode"))
public class Organisation implements Serializable {
	/** Default value included to remove warning. Remove or modify at will. **/
	private static final long serialVersionUID = 1L;

	/***** ATTRIBUTES *****/
	
	@Id
	@Size(min = 2, max = 2)
	@Pattern(regexp = "[A-Za-z ]*", message = " must contain two letters")
	private String countryCode;
	private String countryName;
	private String currency;
	private double vat;
	private String gmtZone;
	/** International dialing code */	 
	private short isd;
	private Date dateCreated;
	private Date dateModified;

	/***** EVENT HOOKS *****/

	@PrePersist
	protected void onCreate() {
		dateCreated = new Date();
	}

	@PreUpdate
	protected void onUpdate() {
		dateModified = new Date();
	}

	/***** GETTER AND SETTERS *****/
	
	public String getCountryCode() {
		return countryCode;
	}

	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}

	public String getCountryName() {
		return countryName;
	}

	public void setCountryName(String countryName) {
		this.countryName = countryName;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public double getVat() {
		return vat;
	}

	public void setVat(double vat) {
		this.vat = vat;
	}

	public String getGmtZone() {
		return gmtZone;
	}

	public void setGmtZone(String gmtZone) {
		this.gmtZone = gmtZone;
	}

	public short getIsd() {
		return isd;
	}

	public void setIsd(short isd) {
		this.isd = isd;
	}

}